/**
 * Estrutura para armazenamento de dados.
 * @returns {Map}
 */
function Map()
{
	this.lastKey = null;
	this.length = 0;
	this.items = new Array();
	
	for (var i = 0; i < arguments.length; i += 2) {
		if (typeof(arguments[i + 1]) != 'undefined') {
			this.items[arguments[i]] = arguments[i + 1];
			this.length++;
		}
	}

	this.remove = function(in_key)
	{
		var tmp_previous;
		if (typeof(this.items[in_key]) != 'undefined') {
			this.length--;
			var tmp_previous = this.items[in_key];
			delete this.items[in_key];
		}

		return tmp_previous;
	};

	this.get = function(in_key) {
		return this.items[in_key];
	};

	this.put = function(in_key, in_value)
	{
		var tmp_previous;
		if (typeof(in_value) != 'undefined') {
			this.lastKey = in_key;
			if (typeof(this.items[in_key]) == 'undefined') {
				this.length++;
			} else {
				tmp_previous = this.items[in_key];
			}
			this.items[in_key] = in_value;
		}
		return tmp_previous;
	};

	this.contains = function(in_key)
	{
		return typeof(this.items[in_key]) != 'undefined';
	};

	this.clear = function()
	{
		for (var i in this.items) {
			delete this.items[i];
		}

		this.length = 0;
	};
	
	this.getLastKey = function()
	{
		return this.lastKey;
	};
}